package com.itita.ww2.handler.requesthandler.cityconstruction;

import com.itita.ww2.core.AbstractClientRequestHandler;
import com.itita.ww2.game.cityconstruction.CityConstructionService;
import com.itita.ww2.handler.requesthandler.cityconstruction.special.GetCollectedSpecial;
import com.itita.ww2.handler.requesthandler.cityconstruction.special.TakeSpecialProduct;
import com.smartfoxserver.v2.annotations.MultiHandler;

@MultiHandler
public class CityConstructionHandler extends AbstractClientRequestHandler {
	public static final String COMMAND_PREFIX = "cityconst";

	@Override
	protected void init() {
		addClientRequestItem("buy", BuyConstruction.class); // 购买产业
		addClientRequestItem("discard", DiscardConstruction.class); // 舍弃产业
		addClientRequestItem("upgrade", UpgradeConstruction.class); // 升级产业
		addClientRequestItem("collectRes", CollectConstRes.class); // 收集产业产出资源
		addClientRequestItem("getuserconsts", GetUserConsts.class); // 获取玩家所有产业
		//
		addClientRequestItem("get_sp_list", GetCollectedSpecial.class); // 获取今日领取特产列表
		addClientRequestItem("take_sp", TakeSpecialProduct.class); // 领取特产

		initTask();
	}

	private void initTask() {
		// 每天X点刷新
		CityConstructionService.startRefreshCitySpecialProductTask();
	}

	@Override
	protected void setCommandPrefix() {
		this.cmd_prefix = COMMAND_PREFIX;
	}

}
